package com.tongwandou.starter.redis.helper.config;

import com.tongwandou.starter.redis.helper.helper.RedisHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.RedisTemplate;

/**
 * @name: RedisHelperAutoConfiguration
 * @description: RedisHelperAutoConfiguration
 * @author: jiangcs
 */
@ConditionalOnClass(RedisHelper.class)
@Configuration
public class RedisHelperAutoConfiguration {
    private RedisTemplate<String, Object> redisTemplate;

    @Bean
    public RedisHelper redisHelper() {
        return new RedisHelper(redisTemplate);
    }

    @Autowired
    public void setRedisTemplate(RedisTemplate<String, Object> redisTemplate) {
        this.redisTemplate = redisTemplate;
    }
}

